package com.lovely602.ai.alibaba.tools;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Description;

import java.util.function.Function;

/**
 * 计算操作工具类
 *
 * @author lizhixing
 */
@Configuration
public class CalcOperationTool {


    public record AddOperation(int a, int b) {

    }

    public record MulOperation(int m, int n) {

    }

    //注册
    @Bean("addOperation")
    @Description("加法运算")
    public Function<AddOperation, Integer> addOperation() {
        return request -> {
            return request.a + request.b;
        };
    }

    @Bean("mulOperation")
    @Description("乘法运算")
    public Function<MulOperation, Integer> mulOperation() {
        return request -> {
            return request.m * request.n;
        };
    }


}
